package gestionColis;

/**
 * Interface definition : GestStation
 * 
 * @author OpenORB Compiler
 */
public class _GestStationStub extends org.omg.CORBA.portable.ObjectImpl
        implements GestStation
{
    static final String[] _ids_list =
    {
        "IDL:gestionColis/GestStation:1.0"
    };

    public String[] _ids()
    {
     return _ids_list;
    }

    private final static Class _opsClass = gestionColis.GestStationOperations.class;

    /**
     * Operation recupererStationAdhesion
     */
    public gestionColis.InfoStation recupererStationAdhesion(gestionColis.InfoAdherent adherent)
        throws gestionColis.AdresseNonDesservieException
    {
        while(true)
        {
            if (!this._is_local())
            {
                org.omg.CORBA.portable.InputStream _input = null;
                try
                {
                    org.omg.CORBA.portable.OutputStream _output = this._request("recupererStationAdhesion",true);
                    gestionColis.InfoAdherentHelper.write(_output,adherent);
                    _input = this._invoke(_output);
                    gestionColis.InfoStation _arg_ret = gestionColis.InfoStationHelper.read(_input);
                    return _arg_ret;
                }
                catch(org.omg.CORBA.portable.RemarshalException _exception)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _exception)
                {
                    String _exception_id = _exception.getId();
                    if (_exception_id.equals(gestionColis.AdresseNonDesservieExceptionHelper.id()))
                    {
                        throw gestionColis.AdresseNonDesservieExceptionHelper.read(_exception.getInputStream());
                    }

                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id);
                }
                finally
                {
                    this._releaseReply(_input);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("recupererStationAdhesion",_opsClass);
                if (_so == null)
                   continue;
                gestionColis.GestStationOperations _self = (gestionColis.GestStationOperations) _so.servant;
                try
                {
                    return _self.recupererStationAdhesion( adherent);
                }
                finally
                {
                    _servant_postinvoke(_so);
                }
            }
        }
    }

    /**
     * Operation calculerCoutTransport
     */
    public double calculerCoutTransport(gestionColis.InfoStation depart, gestionColis.InfoStation arrivee)
        throws gestionColis.StationInconnueException
    {
        while(true)
        {
            if (!this._is_local())
            {
                org.omg.CORBA.portable.InputStream _input = null;
                try
                {
                    org.omg.CORBA.portable.OutputStream _output = this._request("calculerCoutTransport",true);
                    gestionColis.InfoStationHelper.write(_output,depart);
                    gestionColis.InfoStationHelper.write(_output,arrivee);
                    _input = this._invoke(_output);
                    double _arg_ret = _input.read_double();
                    return _arg_ret;
                }
                catch(org.omg.CORBA.portable.RemarshalException _exception)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _exception)
                {
                    String _exception_id = _exception.getId();
                    if (_exception_id.equals(gestionColis.StationInconnueExceptionHelper.id()))
                    {
                        throw gestionColis.StationInconnueExceptionHelper.read(_exception.getInputStream());
                    }

                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id);
                }
                finally
                {
                    this._releaseReply(_input);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("calculerCoutTransport",_opsClass);
                if (_so == null)
                   continue;
                gestionColis.GestStationOperations _self = (gestionColis.GestStationOperations) _so.servant;
                try
                {
                    return _self.calculerCoutTransport( depart,  arrivee);
                }
                finally
                {
                    _servant_postinvoke(_so);
                }
            }
        }
    }

    /**
     * Operation demandeReservationCasier
     */
    public void demandeReservationCasier(gestionColis.InfoStation arrivee, gestionColis.InfoColis colis)
        throws gestionColis.StationInconnueException, gestionColis.AucuneCasierDispoException
    {
        while(true)
        {
            if (!this._is_local())
            {
                org.omg.CORBA.portable.InputStream _input = null;
                try
                {
                    org.omg.CORBA.portable.OutputStream _output = this._request("demandeReservationCasier",true);
                    gestionColis.InfoStationHelper.write(_output,arrivee);
                    gestionColis.InfoColisHelper.write(_output,colis);
                    _input = this._invoke(_output);
                    return;
                }
                catch(org.omg.CORBA.portable.RemarshalException _exception)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _exception)
                {
                    String _exception_id = _exception.getId();
                    if (_exception_id.equals(gestionColis.StationInconnueExceptionHelper.id()))
                    {
                        throw gestionColis.StationInconnueExceptionHelper.read(_exception.getInputStream());
                    }

                    if (_exception_id.equals(gestionColis.AucuneCasierDispoExceptionHelper.id()))
                    {
                        throw gestionColis.AucuneCasierDispoExceptionHelper.read(_exception.getInputStream());
                    }

                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id);
                }
                finally
                {
                    this._releaseReply(_input);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("demandeReservationCasier",_opsClass);
                if (_so == null)
                   continue;
                gestionColis.GestStationOperations _self = (gestionColis.GestStationOperations) _so.servant;
                try
                {
                    _self.demandeReservationCasier( arrivee,  colis);
                    return;
                }
                finally
                {
                    _servant_postinvoke(_so);
                }
            }
        }
    }

    /**
     * Operation enregistrerStation
     */
    public void enregistrerStation(gestionColis.Station station, String codepostal)
        throws gestionColis.StationNonConfigureeException
    {
        while(true)
        {
            if (!this._is_local())
            {
                org.omg.CORBA.portable.InputStream _input = null;
                try
                {
                    org.omg.CORBA.portable.OutputStream _output = this._request("enregistrerStation",true);
                    gestionColis.StationHelper.write(_output,station);
                    _output.write_string(codepostal);
                    _input = this._invoke(_output);
                    return;
                }
                catch(org.omg.CORBA.portable.RemarshalException _exception)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _exception)
                {
                    String _exception_id = _exception.getId();
                    if (_exception_id.equals(gestionColis.StationNonConfigureeExceptionHelper.id()))
                    {
                        throw gestionColis.StationNonConfigureeExceptionHelper.read(_exception.getInputStream());
                    }

                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id);
                }
                finally
                {
                    this._releaseReply(_input);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("enregistrerStation",_opsClass);
                if (_so == null)
                   continue;
                gestionColis.GestStationOperations _self = (gestionColis.GestStationOperations) _so.servant;
                try
                {
                    _self.enregistrerStation( station,  codepostal);
                    return;
                }
                finally
                {
                    _servant_postinvoke(_so);
                }
            }
        }
    }

}
